CC=g++
CFLAGS=-c -Wall
LDFLAGS=

INCLUDES=golf.h compute_hcp.h util.h write_master.h

SCORESOURCES=score.cpp write_master.cpp util.cpp compute_hcp.cpp
SCOREOBJECTS=$(SCORESOURCES:.cpp=.o)
SCOREEXECUTABLE=score.exe

SETUPSOURCES=setup.cpp write_master.cpp compute_hcp.cpp util.cpp
SETUPOBJECTS=$(SETUPSOURCES:.cpp=.o)
SETUPEXECUTABLE=setup.exe

all: $(SETUPSOURCES) $(SETUPEXECUTABLE) $(SCORESOURCES) $(SCOREEXECUTABLE)

$(SCOREEXECUTABLE): $(SCOREOBJECTS) $(INCLUDES)
	$(CC) $(LDFLAGS) $(SCOREOBJECTS) -o $@

$(SETUPEXECUTABLE): $(SETUPOBJECTS) $(INCLUDES)
	$(CC) $(LDFLAGS) $(SETUPOBJECTS) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@

clean:
	\rm *.o *.exe

